<?
	require "lib.php";
	
	if(!boardExists($_GET["bid"])) alertAndBack("존재하지 않는 게시판 입니다!");
	if(intval($_GET["id"])) $article = getArticle($_GET["bid"], intval($_GET["id"]));
	else { alertAndBack("잘못된 접근입니다!"); exit; }
	
	$board_info = boardInfo($_GET["bid"]);
	if($article["memberid"] != $_SESSION["loginIdx"] && $_SESSION["loginAdmin"] != "True" && $board_info["writeadmin"] == "1") { alertAndBack("권한이 없습니다!"); exit; }
	if(!$article["title"]) { alertAndBack("삭제된 글입니다!"); exit; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title> IWOP BOARD ALPHA </title>
</head>
<body>
	<form action="update.php?bid=<?echo $_GET["bid"];?>" method="post">
		<table border="1">
			<tr>
				<td>제목</td>
				<? echo "<td><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"50\" value=\"".$article["title"]."\" /></td>\n"; ?>
			</tr>
			<tr>
				<td>내용</td>
				<? echo "<td><textarea name=\"content\" cols=\"45\" rows=\"20\">".$article["content"]."</textarea></td>\n"; ?>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="수정하기" /><input type="reset" value="초기화" /></td>
			</tr>
		</table>
		<? echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET["id"]."\" />\n"; ?>
	</form>
</body>
</html>